<?php

use Carbon\Carbon;
use Illuminate\Database\Seeder;

class PermissionTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
    	$permissions = [
    		[
    			'code' => 'dashboard',
    			'name' => '访问管理后台首页权限',
    			'parent_code' => null,
    			'permissiontable_id' => 1,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'basic',
    			'name' => '基础档案管理权限',
    			'parent_code' => null,
    			'permissiontable_id' => 2,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],
			[
    			'code' => 'report',
    			'name' => '分析报表管理权限',
    			'parent_code' => null,
    			'permissiontable_id' => 4,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'notify',
    			'name' => '通知信息管理权限',
    			'parent_code' => null,
    			'permissiontable_id' => 5,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'system',
    			'name' => '系统管理权限',
    			'parent_code' => null,
    			'permissiontable_id' => 6,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'basic-company-index',
    			'name' => '公司管理权限',
    			'parent_code' => 'basic',
    			'permissiontable_id' => 7,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'basic-shop-index',
    			'name' => '组织管理权限',
    			'parent_code' => 'basic',
    			'permissiontable_id' => 8,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
				'code' => 'basic-user-index',
				'name' => '人员管理管理权限',
				'parent_code' => 'basic',
				'permissiontable_id' => 9,
				'permissiontable_type' => 'menu',
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
                'code' => 'basic-task-index',
                'name' => '任务管理管理权限',
                'parent_code' => 'basic',
                'permissiontable_id' => 10,
                'permissiontable_type' => 'menu',
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now()
            ],[
    			'code' => 'basic-category-index',
    			'name' => '任务绑定管理权限',
    			'parent_code' => 'basic',
    			'permissiontable_id' => 11,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'report-shop-index',
    			'name' => '组织维度报表管理权限',
    			'parent_code' => 'report',
    			'permissiontable_id' => 12,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'report-user-index',
    			'name' => '人员维度报表管理权限',
    			'parent_code' => 'report',
    			'permissiontable_id' => 13,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'report-task-index',
    			'name' => '计划维度报表管理权限',
    			'parent_code' => 'report',
    			'permissiontable_id' => 14,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],
            [
                'code' => 'report-xun-dian-shu-ju-index',
                'name' => '组织数据权限',
                'parent_code' => 'report',
                'permissiontable_id' => 22,
                'permissiontable_type' => 'menu',
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now()
            ],
			[
    			'code' => 'notify-publish-index',
    			'name' => '发布通知权限',
    			'parent_code' => 'notify',
    			'permissiontable_id' => 19,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'system-role-index',
    			'name' => '角色管理权限',
    			'parent_code' => 'system',
    			'permissiontable_id' => 20,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
    			'code' => 'system-banner-index',
    			'name' => '修改Banner权限',
    			'parent_code' => 'system',
    			'permissiontable_id' => 21,
    			'permissiontable_type' => 'menu',
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],
			//公司管理细分权限
			[
    			'code' => 'basic-company-update',
    			'name' => '修改公司信息权限',
    			'parent_code' => 'basic-company-index',
    			'permissiontable_id' => null,
    			'permissiontable_type' => null,
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],
			//组织管理细分权限
			[
    			'code' => 'basic-shop-store',
    			'name' => '创建组织信息权限',
    			'parent_code' => 'basic-shop-index',
    			'permissiontable_id' => null,
    			'permissiontable_type' => null,
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],[
				'code' => 'basic-shop-destroy',
				'name' => '删除组织信息权限',
				'parent_code' => 'basic-shop-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
    			'code' => 'basic-shop-update',
    			'name' => '修改组织信息权限',
    			'parent_code' => 'basic-shop-index',
    			'permissiontable_id' => null,
    			'permissiontable_type' => null,
    			'created_at' => Carbon::now(),
    			'updated_at' => Carbon::now()
			],
			//巡检类型细分权限
			[
				'code' => 'basic-category-store',
				'name' => '创建任务分类信息权限',
				'parent_code' => 'basic-category-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-category-destroy',
				'name' => '删除任务分类信息权限',
				'parent_code' => 'basic-category-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-category-update',
				'name' => '修改任务分类信息权限',
				'parent_code' => 'basic-category-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],
			//任务库细分权限
			[
				'code' => 'basic-task-store',
				'name' => '创建任务管理信息权限',
				'parent_code' => 'basic-task-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-task-destroy',
				'name' => '删除任务管理信息权限',
				'parent_code' => 'basic-task-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-task-update',
				'name' => '修改任务管理信息权限',
				'parent_code' => 'basic-task-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],
			//人员管理细分权限
			[
				'code' => 'basic-user-store',
				'name' => '创建人员管理权限',
				'parent_code' => 'basic-user-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-user-destroy',
				'name' => '删除人员管理权限',
				'parent_code' => 'basic-user-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'basic-user-update',
				'name' => '修改人员管理权限',
				'parent_code' => 'basic-user-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],
			//任务审核细分权限
//			[
//				'code' => 'audit-task-update',
//				'name' => '审批任务权限',
//				'parent_code' => 'audit-task-index',
//				'permissiontable_id' => null,
//				'permissiontable_type' => null,
//				'created_at' => Carbon::now(),
//				'updated_at' => Carbon::now()
//			],
//			[
//				'code' => 'audit-plan-update',
//				'name' => '审批用户提交的计划权限',
//				'parent_code' => 'audit-plan-index',
//				'permissiontable_id' => null,
//				'permissiontable_type' => null,
//				'created_at' => Carbon::now(),
//				'updated_at' => Carbon::now()
//			],
//			[
//				'code' => 'audit-leave-update',
//				'name' => '审批用户提交的请假权限',
//				'parent_code' => 'audit-leave-index',
//				'permissiontable_id' => null,
//				'permissiontable_type' => null,
//				'created_at' => Carbon::now(),
//				'updated_at' => Carbon::now()
//			],
			//人员管理细分权限
			[
				'code' => 'system-role-store',
				'name' => '创建角色信息权限',
				'parent_code' => 'system-role-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'system-role-destroy',
				'name' => '删除角色信息权限',
				'parent_code' => 'system-role-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'system-role-update',
				'name' => '修改角色信息权限',
				'parent_code' => 'system-role-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],
			//人员管理细分权限
			[
				'code' => 'system-banner-store',
				'name' => '创建Banner信息权限',
				'parent_code' => 'system-banner-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'system-banner-destroy',
				'name' => '删除Banner信息权限',
				'parent_code' => 'system-banner-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			],[
				'code' => 'system-banner-update',
				'name' => '修改Banner信息权限',
				'parent_code' => 'system-banner-index',
				'permissiontable_id' => null,
				'permissiontable_type' => null,
				'created_at' => Carbon::now(),
				'updated_at' => Carbon::now()
			]
		];

    	DB::table('permissions')->insert($permissions);
    }
}
